program MonteCarlo;

{$APPTYPE CONSOLE}

uses
  SysUtils;
var
  i,N,N0: integer;
  x, y, p,d: double;
  fout: textFile;

begin
  randomize;
  assignFile(fout, 'output.txt');
  rewrite(fout);
  N:=0;
  N0:=0;
  for i:= 0 to 100000000 do
  begin
    N:=N+1;
    x:=2*random;
    y:=2*random;
    if(((x-1)*(x-1)+(y-1)*(y-1))<=1) then
    begin
      N0:=N0+1;
    end;
    if((N mod 10000)=0) then
    begin
      writeln(fout, Pi - ((4*N0)/N):0:8 );
    end;
  end;
  closeFile(fout);
end.
